package com.ftg.learn.execl.util;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;

/**
 * @author 布衣
 */
@Data
public class R<T> {

    private Integer code;

    private String msg;

    private T data;

    /**
     * 构建返回对象
     *
     * @param code 状态码
     * @param msg  消息
     * @param data 数据
     * @param <T>
     * @return R<T>
     */
    public static <T> R<T> build(Integer code, String msg, T data) {
        R<T> r = new R<>();
        r.setCode(code);
        r.setMsg(msg);
        r.setData(data);
        return r;
    }

    public static <T> R<T> build(Integer code, String msg) {
        return build(code, msg, null);
    }

    public static <T> R<T> build(Integer code) {
        return build(code, null, null);
    }

}
